/**
 *
 *
 */
if(typeof (module) !="undefined"){
    module.exports = FEffectBase; //

    var define = require('../../define').getDefine();

}

function FEffectBase()
{
    this.id = -1;// 颜色id
    this.type =  FEffectBase.prototype.TYPE_EFFECT_BASE; // 类型
}

// 类型-基类
FEffectBase.prototype.TYPE_EFFECT_BASE = 99;//

// 类型-颜色类
FEffectBase.prototype.TYPE_COLOR_BASE = 100;
FEffectBase.prototype.TYPE_COLOR = 101;
FEffectBase.prototype.TYPE_GRADIENT = 102;
FEffectBase.prototype.TYPE_PATTERN = 103;

// 类型-风格化类
FEffectBase.prototype.TYPE_STYLIZE_BASE = 200;
FEffectBase.prototype.TYPE_STYLIZE_SHADOW = 201;

// 类型-变形类
FEffectBase.prototype.TYPE_TRANSFORM_BASE = 400;
FEffectBase.prototype.TYPE_FLIP = 401;
FEffectBase.prototype.TYPE_FUNC = 402;

// 类型-滤镜类
FEffectBase.prototype.TYPE_FILTER_BASE = 500;
FEffectBase.prototype.TYPE_IMAGE_FILTER = 501;

// 类型-形状类
FEffectBase.prototype.TYPE_GRAPH_BASE = 600;
FEffectBase.prototype.TYPE_STROKE = 601;

// 从一个未知json对象中，解析出对应Obj(在文档初始化的时候使用)
FEffectBase.prototype.fromUnknownJson =  function (colorObj, versionId){
    if(typeof (module) !="undefined"){
        var FEffectParserEx = require('./FEffectParser');
        return FEffectParserEx.prototype.fromUnknownJson(colorObj, versionId);
    }else{
        return FEffectParser.prototype.fromUnknownJson(colorObj, versionId);
    }
}
// 拷贝
FEffectBase.prototype.clone = function(){
    return FEffectBase.prototype.fromUnknownJson(JSON.parse(this.toJson()),define.VERSION_CURRENT);
}
// 转成json字符串
FEffectBase.prototype.toJson = function(){
    var ret = '{';
    // id
    ret += '"id":';
    ret += this.id;
    // type
    ret +=',';
    ret += '"type":';
    ret += this.type;
    ret+='}';
    return ret;
}

// 从json对象中解析出PointPath
FEffectBase.prototype.fromJson = function(jsonObj, versionId){
    this.id = jsonObj.id;
    this.type = jsonObj.type;
}
